#!/usr/bin/env bash
#
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2014-2019, Intel Corporation
# Copyright 2019, IBM Corporation

#
# src/test/blk_rw/TEST15 -- unit test for pmemblk_read/write/set_zero/set_error
#
# This test is equivalent of TEST1 for ppc64le platform.
#

. ../unittest/unittest.sh

require_test_type medium
require_ppc64

# doesn't make sense to run in local directory
require_fs_type pmem non-pmem
require_unlimited_vm

# this test creates huge file
configure_valgrind force-disable

setup

# multi-arena case
truncate -s 1026G $DIR/testfile1
#
# All reads to an unwritten block pool should return zeros.
# Block 2134997374 is out of range and should return EINVAL.
# Attempts to zero uninitialized blocks are nops (should succeed).
#
expect_normal_exit ./blk_rw$EXESUFFIX 512 $DIR/testfile1 c\
	r:0 r:1 r:4161480 r:2134997087 r:2134997088 z:0 z:4161480

check_pool $DIR/testfile1

check

pass
